﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;
using System.Collections.ObjectModel;
using University.Workshop.DataAccess;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for WatchListManagerTest and is intended
    ///to contain all WatchListManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class WatchListManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for AddToWatchList
        ///</summary>
        [TestMethod()]
        public void AddToWatchListTest()
        {
            UserRegistrationManager.RegisterUser("Correo", "Prueba", 'F', DateTime.Now, "lqs.correo.prueba@gmail.com", "loquesea123", "loquesea123", "Cochabamba", "Cochabamba", "79393047", "4530514");
            string email = "lqs.correo.prueba@gmail.com";
            User user=UserDataAccess.GetUserByEmail(email);
            Product product=ProductRegistrationManager.RegisterNewProduct("Magic Mouse","200","Este mouse de Apple es inalambrico y se conecta a la computadora via bluetooh, te permite hacer un sin fin de funcionalidades","Electronics",false,"Bolivianos",user.Id,"1");
            long productId = product.ProductId; // TODO: Initialize to an appropriate value
            long userId = user.Id; // TODO: Initialize to an appropriate value
            string comment = "ME GUSTA"; // TODO: Initialize to an appropriate value
            Collection<WatchListItem> list = new Collection<WatchListItem>();
            Collection<WatchListItem> expected = new Collection<WatchListItem>();
            expected=null;
            Collection<WatchListItem> actual;
            actual = WatchListManager.AddToWatchList(productId, userId, comment, list);
            Assert.AreNotEqual(expected, actual);
        }

        /// <summary>
        ///A test for RemoveItem
        ///</summary>
        [TestMethod()]
        public void RemoveItemTest()
        {
            //UserRegistrationManager.RegisterUser("Natalia","Alfaro",'F',DateTime.Now,"alfaro.natalia.lorena@gmail.com","password123","password123","Cochabamba","Cochabamba","79393047","4530514")
            string email = "lqs.correo.prueba@gmail.com";
            UserRegistrationManager.RegisterUser("Correo", "Prueba", 'F', DateTime.Now, "lqs.correo.prueba@gmail.com", "loquesea123", "loquesea123", "Cochabamba", "Cochabamba", "79393047", "4530514");
            User user=UserDataAccess.GetUserByEmail(email);
            Product product=ProductRegistrationManager.RegisterNewProduct("Magic Mouse","100","Este mouse de Apple es inalambrico y se conecta a la computadora via bluetooh, te permite hacer un sin fin de funcionalidades","Electronics",false,"Bolivianos",user.Id,"1");
            WatchListDataAccess.InsertProduct(user.Id, product.ProductId, "Some random comment");
            long productId = product.ProductId; // TODO: Initialize to an appropriate value
            long userId = user.Id; // TODO: Initialize to an appropriate value
            Collection<WatchListItem> list = new Collection<WatchListItem>(); // TODO: Initialize to an appropriate value
            Collection<WatchListItem> expected = null; // TODO: Initialize to an appropriate value
            Collection<WatchListItem> actual;
            actual = WatchListManager.RemoveItem(userId, productId, list);
            Assert.AreNotEqual(expected, actual);
        }
    }
}
